.class Lcom/xingbook/paint/view/c;
.super Landroid/view/View;


# instance fields
.field private a:Landroid/graphics/Paint;

.field private b:Landroid/graphics/Paint;

.field private c:Landroid/graphics/Paint;

.field private final d:[I

.field private e:[I

.field private f:Z

.field private g:Lcom/xingbook/paint/view/d;

.field private h:Z

.field private i:Z


# direct methods
.method constructor <init>(Landroid/content/Context;Lcom/xingbook/paint/view/d;I)V
    .locals 5

    const/4 v4, 0x0

    const/4 v3, 0x1

    invoke-direct {p0, p1}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    iput-object p2, p0, Lcom/xingbook/paint/view/c;->g:Lcom/xingbook/paint/view/d;

    const/4 v0, 0x7

    new-array v0, v0, [I

    fill-array-data v0, :array_0

    iput-object v0, p0, Lcom/xingbook/paint/view/c;->d:[I

    new-instance v0, Landroid/graphics/SweepGradient;

    iget-object v1, p0, Lcom/xingbook/paint/view/c;->d:[I

    const/4 v2, 0x0

    invoke-direct {v0, v4, v4, v1, v2}, Landroid/graphics/SweepGradient;-><init>(FF[I[F)V

    new-instance v1, Landroid/graphics/Paint;

    invoke-direct {v1, v3}, Landroid/graphics/Paint;-><init>(I)V

    iput-object v1, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    iget-object v1, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    invoke-virtual {v1, v0}, Landroid/graphics/Paint;->setShader(Landroid/graphics/Shader;)Landroid/graphics/Shader;

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Style;->STROKE:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    const/high16 v1, 0x42a0

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0, v3}, Landroid/graphics/Paint;-><init>(I)V

    iput-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {v0, p3}, Landroid/graphics/Paint;->setColor(I)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    const/high16 v1, 0x40a0

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    const/4 v0, 0x3

    new-array v0, v0, [I

    const/4 v1, 0x0

    const/high16 v2, -0x100

    aput v2, v0, v1

    aput p3, v0, v3

    const/4 v1, 0x2

    const/4 v2, -0x1

    aput v2, v0, v1

    iput-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0, v3}, Landroid/graphics/Paint;-><init>(I)V

    iput-object v0, p0, Lcom/xingbook/paint/view/c;->c:Landroid/graphics/Paint;

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->c:Landroid/graphics/Paint;

    const/high16 v1, 0x4120

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStrokeWidth(F)V

    iput-boolean v3, p0, Lcom/xingbook/paint/view/c;->f:Z

    return-void

    nop

    :array_0
    .array-data 0x4
        0x0t 0x0t 0xfft 0xfft
        0xfft 0x0t 0xfft 0xfft
        0xfft 0x0t 0x0t 0xfft
        0xfft 0xfft 0x0t 0xfft
        0x0t 0xfft 0x0t 0xfft
        0x0t 0xfft 0xfft 0xfft
        0x0t 0x0t 0xfft 0xfft
    .end array-data
.end method

.method private a(IIF)I
    .locals 1

    sub-int v0, p2, p1

    int-to-float v0, v0

    mul-float/2addr v0, p3

    invoke-static {v0}, Ljava/lang/Math;->round(F)I

    move-result v0

    add-int/2addr v0, p1

    return v0
.end method

.method private a([IF)I
    .locals 7

    const/4 v0, 0x0

    cmpg-float v0, p2, v0

    if-gtz v0, :cond_0

    const/4 v0, 0x0

    aget v0, p1, v0

    :goto_0
    return v0

    :cond_0
    const/high16 v0, 0x3f80

    cmpl-float v0, p2, v0

    if-ltz v0, :cond_1

    array-length v0, p1

    add-int/lit8 v0, v0, -0x1

    aget v0, p1, v0

    goto :goto_0

    :cond_1
    array-length v0, p1

    add-int/lit8 v0, v0, -0x1

    int-to-float v0, v0

    mul-float/2addr v0, p2

    float-to-int v1, v0

    int-to-float v2, v1

    sub-float/2addr v0, v2

    aget v2, p1, v1

    add-int/lit8 v1, v1, 0x1

    aget v1, p1, v1

    invoke-static {v2}, Landroid/graphics/Color;->alpha(I)I

    move-result v3

    invoke-static {v1}, Landroid/graphics/Color;->alpha(I)I

    move-result v4

    invoke-direct {p0, v3, v4, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v3

    invoke-static {v2}, Landroid/graphics/Color;->red(I)I

    move-result v4

    invoke-static {v1}, Landroid/graphics/Color;->red(I)I

    move-result v5

    invoke-direct {p0, v4, v5, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v4

    invoke-static {v2}, Landroid/graphics/Color;->green(I)I

    move-result v5

    invoke-static {v1}, Landroid/graphics/Color;->green(I)I

    move-result v6

    invoke-direct {p0, v5, v6, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v5

    invoke-static {v2}, Landroid/graphics/Color;->blue(I)I

    move-result v2

    invoke-static {v1}, Landroid/graphics/Color;->blue(I)I

    move-result v1

    invoke-direct {p0, v2, v1, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v0

    invoke-static {v3, v4, v5, v0}, Landroid/graphics/Color;->argb(IIII)I

    move-result v0

    goto :goto_0
.end method


# virtual methods
.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 14

    const/4 v13, 0x1

    const/high16 v12, 0x4248

    const/high16 v11, 0x4316

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    invoke-virtual {v0}, Landroid/graphics/Paint;->getStrokeWidth()F

    move-result v0

    const/high16 v1, 0x3f00

    mul-float/2addr v0, v1

    sub-float v8, v11, v0

    invoke-virtual {p1, v11, v11}, Landroid/graphics/Canvas;->translate(FF)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {v0}, Landroid/graphics/Paint;->getColor()I

    move-result v9

    iget-boolean v0, p0, Lcom/xingbook/paint/view/c;->f:Z

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    aput v9, v0, v13

    iget-object v10, p0, Lcom/xingbook/paint/view/c;->c:Landroid/graphics/Paint;

    new-instance v0, Landroid/graphics/LinearGradient;

    const/high16 v1, -0x3d38

    const/high16 v3, 0x42c8

    iget-object v5, p0, Lcom/xingbook/paint/view/c;->e:[I

    const/4 v6, 0x0

    sget-object v7, Landroid/graphics/Shader$TileMode;->CLAMP:Landroid/graphics/Shader$TileMode;

    move v4, v2

    invoke-direct/range {v0 .. v7}, Landroid/graphics/LinearGradient;-><init>(FFFF[I[FLandroid/graphics/Shader$TileMode;)V

    invoke-virtual {v10, v0}, Landroid/graphics/Paint;->setShader(Landroid/graphics/Shader;)Landroid/graphics/Shader;

    :cond_0
    new-instance v0, Landroid/graphics/RectF;

    neg-float v1, v8

    neg-float v3, v8

    invoke-direct {v0, v1, v3, v8, v8}, Landroid/graphics/RectF;-><init>(FFFF)V

    iget-object v1, p0, Lcom/xingbook/paint/view/c;->a:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1}, Landroid/graphics/Canvas;->drawOval(Landroid/graphics/RectF;Landroid/graphics/Paint;)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {p1, v2, v2, v12, v0}, Landroid/graphics/Canvas;->drawCircle(FFFLandroid/graphics/Paint;)V

    new-instance v0, Landroid/graphics/RectF;

    const/high16 v1, -0x3cea

    const/high16 v3, 0x4348

    const/high16 v4, 0x4320

    invoke-direct {v0, v1, v3, v11, v4}, Landroid/graphics/RectF;-><init>(FFFF)V

    iget-object v1, p0, Lcom/xingbook/paint/view/c;->c:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1}, Landroid/graphics/Canvas;->drawRect(Landroid/graphics/RectF;Landroid/graphics/Paint;)V

    iget-boolean v0, p0, Lcom/xingbook/paint/view/c;->h:Z

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Style;->STROKE:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    iget-boolean v0, p0, Lcom/xingbook/paint/view/c;->i:Z

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    const/16 v1, 0xff

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    :goto_0
    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {v0}, Landroid/graphics/Paint;->getStrokeWidth()F

    move-result v0

    add-float/2addr v0, v12

    iget-object v1, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {p1, v2, v2, v0, v1}, Landroid/graphics/Canvas;->drawCircle(FFFLandroid/graphics/Paint;)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {v0, v9}, Landroid/graphics/Paint;->setColor(I)V

    :cond_1
    iput-boolean v13, p0, Lcom/xingbook/paint/view/c;->f:Z

    return-void

    :cond_2
    iget-object v0, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    const/16 v1, 0x80

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAlpha(I)V

    goto :goto_0
.end method

.method protected onMeasure(II)V
    .locals 2

    const/16 v0, 0x12c

    const/16 v1, 0x15e

    invoke-virtual {p0, v0, v1}, Lcom/xingbook/paint/view/c;->setMeasuredDimension(II)V

    return-void
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 14

    const/4 v13, 0x0

    const-wide/high16 v11, 0x4000

    const/4 v2, 0x0

    const/high16 v10, 0x4316

    const/4 v1, 0x1

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v0

    sub-float v5, v0, v10

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getY()F

    move-result v0

    sub-float v4, v0, v10

    mul-float v0, v5, v5

    mul-float v3, v4, v4

    add-float/2addr v0, v3

    float-to-double v6, v0

    invoke-static {v6, v7}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v6

    const-wide/high16 v8, 0x4049

    cmpg-double v0, v6, v8

    if-gtz v0, :cond_1

    move v0, v1

    :goto_0
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v3

    packed-switch v3, :pswitch_data_0

    :cond_0
    :goto_1
    return v1

    :cond_1
    move v0, v2

    goto :goto_0

    :pswitch_0
    iput-boolean v0, p0, Lcom/xingbook/paint/view/c;->h:Z

    if-eqz v0, :cond_2

    iput-boolean v1, p0, Lcom/xingbook/paint/view/c;->i:Z

    invoke-virtual {p0}, Lcom/xingbook/paint/view/c;->invalidate()V

    goto :goto_1

    :cond_2
    :pswitch_1
    iget-boolean v3, p0, Lcom/xingbook/paint/view/c;->h:Z

    if-eqz v3, :cond_3

    iget-boolean v2, p0, Lcom/xingbook/paint/view/c;->i:Z

    if-eq v2, v0, :cond_0

    iput-boolean v0, p0, Lcom/xingbook/paint/view/c;->i:Z

    invoke-virtual {p0}, Lcom/xingbook/paint/view/c;->invalidate()V

    goto :goto_1

    :cond_3
    const/high16 v0, -0x3cea

    cmpl-float v0, v5, v0

    if-ltz v0, :cond_4

    move v3, v1

    :goto_2
    cmpg-float v0, v5, v10

    if-gtz v0, :cond_5

    move v0, v1

    :goto_3
    and-int/2addr v0, v3

    if-eqz v0, :cond_7

    const/high16 v0, 0x4348

    cmpg-float v0, v4, v0

    if-gtz v0, :cond_7

    const/high16 v0, 0x4320

    cmpl-float v0, v4, v0

    if-ltz v0, :cond_7

    cmpg-float v0, v5, v13

    if-gez v0, :cond_6

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    aget v4, v0, v2

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    aget v3, v0, v1

    add-float v0, v5, v10

    div-float/2addr v0, v10

    :goto_4
    invoke-static {v4}, Landroid/graphics/Color;->alpha(I)I

    move-result v5

    invoke-static {v3}, Landroid/graphics/Color;->alpha(I)I

    move-result v6

    invoke-direct {p0, v5, v6, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v5

    invoke-static {v4}, Landroid/graphics/Color;->red(I)I

    move-result v6

    invoke-static {v3}, Landroid/graphics/Color;->red(I)I

    move-result v7

    invoke-direct {p0, v6, v7, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v6

    invoke-static {v4}, Landroid/graphics/Color;->green(I)I

    move-result v7

    invoke-static {v3}, Landroid/graphics/Color;->green(I)I

    move-result v8

    invoke-direct {p0, v7, v8, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v7

    invoke-static {v4}, Landroid/graphics/Color;->blue(I)I

    move-result v4

    invoke-static {v3}, Landroid/graphics/Color;->blue(I)I

    move-result v3

    invoke-direct {p0, v4, v3, v0}, Lcom/xingbook/paint/view/c;->a(IIF)I

    move-result v0

    iget-object v3, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-static {v5, v6, v7, v0}, Landroid/graphics/Color;->argb(IIII)I

    move-result v0

    invoke-virtual {v3, v0}, Landroid/graphics/Paint;->setColor(I)V

    iput-boolean v2, p0, Lcom/xingbook/paint/view/c;->f:Z

    invoke-virtual {p0}, Lcom/xingbook/paint/view/c;->invalidate()V

    goto/16 :goto_1

    :cond_4
    move v3, v2

    goto :goto_2

    :cond_5
    move v0, v2

    goto :goto_3

    :cond_6
    iget-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    aget v4, v0, v1

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->e:[I

    const/4 v3, 0x2

    aget v3, v0, v3

    div-float v0, v5, v10

    goto :goto_4

    :cond_7
    float-to-double v2, v5

    invoke-static {v2, v3, v11, v12}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v2

    float-to-double v6, v4

    invoke-static {v6, v7, v11, v12}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v6

    add-double/2addr v2, v6

    const-wide v6, 0x40d5f90000000000L

    cmpg-double v0, v2, v6

    if-gez v0, :cond_0

    float-to-double v2, v4

    float-to-double v4, v5

    invoke-static {v2, v3, v4, v5}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v2

    double-to-float v0, v2

    const v2, 0x40c90fda

    div-float/2addr v0, v2

    cmpg-float v2, v0, v13

    if-gez v2, :cond_8

    const/high16 v2, 0x3f80

    add-float/2addr v0, v2

    :cond_8
    iget-object v2, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    iget-object v3, p0, Lcom/xingbook/paint/view/c;->d:[I

    invoke-direct {p0, v3, v0}, Lcom/xingbook/paint/view/c;->a([IF)I

    move-result v0

    invoke-virtual {v2, v0}, Landroid/graphics/Paint;->setColor(I)V

    invoke-virtual {p0}, Lcom/xingbook/paint/view/c;->invalidate()V

    goto/16 :goto_1

    :pswitch_2
    iget-boolean v3, p0, Lcom/xingbook/paint/view/c;->h:Z

    if-eqz v3, :cond_0

    if-eqz v0, :cond_9

    iget-object v0, p0, Lcom/xingbook/paint/view/c;->g:Lcom/xingbook/paint/view/d;

    iget-object v3, p0, Lcom/xingbook/paint/view/c;->b:Landroid/graphics/Paint;

    invoke-virtual {v3}, Landroid/graphics/Paint;->getColor()I

    move-result v3

    invoke-interface {v0, v3}, Lcom/xingbook/paint/view/d;->b(I)V

    :cond_9
    iput-boolean v2, p0, Lcom/xingbook/paint/view/c;->h:Z

    invoke-virtual {p0}, Lcom/xingbook/paint/view/c;->invalidate()V

    goto/16 :goto_1

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_2
        :pswitch_1
    .end packed-switch
.end method
